var express = require('express');
var { User } = require('../sql/user_mysql');
const router = express.Router();

router.get('/list', async (req, res) => {
	let data = await User.findAll();
	res.send({
		code: 200,
		message: '查询成功',
		data,
	});
});

router.get('/add', async (req, res) => {
	let d = await User.create({
		...req.query,
	});
	console.log(d);
	res.send({
		code: 200,
		message: '添加成功',
	});
});

module.exports = router;
